hb = 200;         % 基站天线高度（单位：米）
hm = 3;           % 手机天线高度（单位：米）
d = [1 2 5 10 30 50 60 80 100]*1000;   % 不同传播距离（单位：米）
f = 150:10:1920;  % 不同载波频率（单位：MHz）

% 计算Okumura模型下的传播损耗
subplot(311)
for i = 1:length(d)
    for j = 1:length(f)
        if f(j) < 200
            a = 8.29*(log10(1.54)*hm)^2 - 4.97;
        elseif f(j) > 200
            a = 3.2*(log10(11.75)*hm)^2 - 4.97;
        end
        lb = 69.5 + 26.16*log10(f(j)) - 13.82*log10(hb) - a + (44.9-6.55*log10(hb))*log10(d(i));
        plot(f(j), lb);
        xlabel('f');
        ylabel('Path Loss');
        hold on;
    end
end




    
subplot(312)
for i = 1:length(d)
    lb = 69.5 + 26.16*log10(f) - 13.82*log10(hb) - a + (44.9-6.55*log10(hb))*log10(d(i));
	lb2=lb-2.*(log10(f./28)).^2-5.4;
   % plot(f,lb2);xlabel('f');ylabel('d')
    hold on
end


subplot(313)
for i = 1:length(d)
    lb = 69.5 + 26.16*log10(f) - 13.82*log10(hb) - a + (44.9-6.55*log10(hb))*log10(d(i));
	lb2=lb-4.78.*(log10(f)).^2+18.33*log10(f)-40.94;
    %plot(f,la);xlabel('f');ylabel('d')
    hold on
end
